package com.kaishengit.service;


import org.springframework.transaction.annotation.Transactional;


import java.util.List;



import com.kaishengit.dao.TypeDao;
import com.kaishengit.pojo.Type;

@Transactional
public class TypeService {
	private TypeDao typeDao;
	
	
	public List<Type> find(String hql,Object...args) {
		return typeDao.find(hql,args);
	}
	
	public void savetasktype(Type tasktype) {
		tasktype.setTypea("taskstype");
		typeDao.save(tasktype);
	}
	
	public void savedealtype(Type dealtype) {
		dealtype .setTypea("dealstate");
		typeDao.save(dealtype);
	}

	
	public void save(Type phonetype) {
		phonetype.setTypea("phone");
		typeDao.save(phonetype);
	}
	
	public Type findtasktype(String id) {
		return typeDao.get(id);
	}
	
	public void del(Type type){
		typeDao.del(type);
	}
	// set get
	public void setTypeDao(TypeDao typeDao) {
		this.typeDao = typeDao;
	}

	

	public Type findByUserid(String userid, String phonetype) {
		String hql="from Type where userid=? and typea=?";
		
		return typeDao.findUnique(hql, userid,phonetype);
	}

	public void edit(Type phonetype) {
		typeDao.save(phonetype);
	}
}
